#include<iostream>
#include<vector>
using namespace std;

class MinStack {
private:
    vector<int> real;
    vector<int> min_fir;
public:
    /** initialize your data structure here. */
    MinStack() 
    {
    }
    
    void push(int x) 
    {
        real.push_back(x);
        if(min_fir.size()>=1)
        {
            int tmp=min_fir[min_fir.size()-1];
            min_fir.push_back(tmp<x?tmp:x);
        }
        else
        {
            min_fir.push_back(x);
        }

    }
    
    void pop() 
    {
        if(real.size()>=1)
        {
            real.pop_back();
            min_fir.pop_back();
        }
    }
    
    int top() 
    {
        return real[real.size()-1];
    }
    
    int min() 
    {
        return min_fir[min_fir.size()-1];
    }


};

int main()
{
    MinStack m;
    m.push(-2);
    m.push(0);
    m.push(-3);
    cout<<m.min()<<endl;
    m.pop();
    cout<<m.top()<<endl;
    cout<<m.min()<<endl;
    return 0;
}